﻿using System;
using System.Collections.Generic;
using System.Text;
using Flexible.Interfaces;

namespace Flexible.Implementions.Bases
{
    public class PluginQuery : IPluginQuery
    {
        public PluginQuery(string id, Version version)
        {
            this.id = id;
            this.version = version;
        }

        readonly string id;
        readonly Version version;

        public string Id
        {
            get { return id; }
        }
        public Version Version
        {
            get { return version; }
        }

        public bool IsMatch(IPluginSignature signature)
        {
            if (id != signature.Id)
                return false;
            if (version != null)
                return signature.Version == version || signature.CompatibleVersion == version;

            return true;
        }
    }
}
